package com.kfirszt.elearning.persistence.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "quiz_attempt")
public class QuizAttempt extends BaseEntity {

	private static final long serialVersionUID = 1L;
	
	@Column(name = "quiz_id", insertable = false, updatable = false)
	private Long quizId;
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "quiz_id")
	private Quiz quiz;

	@OneToMany(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "quiz_attempt")
	private List<QuestionAttempt> questionAttempts = new ArrayList<QuestionAttempt>();
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = {})
	@JoinColumn(name = "student_id")
	private Student student;

	public Long getQuizId() {
		return quizId;
	}

	public void setQuizId(Long quizId) {
		this.quizId = quizId;
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	public List<QuestionAttempt> getQuestionAttempts() {
		return questionAttempts;
	}

	public void setQuestionAttempts(List<QuestionAttempt> questionAttempts) {
		this.questionAttempts = questionAttempts;
	}
}
